package main

import "fmt"

func main() {
	// 定义一个3行4列的二维数组，逐个从键盘输入值，编写程序将四周数据清0
	//var twoDimensionArr = [][]int{{1, 2, 3, 4}, {1, 2, 3, 4}, {1, 2, 3, 4}}
	// 输入操作
	var twoDimensionArr [3][4]int
	var num int
	for i := 0; i < 3; i++ {
		for j := 0; j < 4; j++ {
			fmt.Printf("请输入第%d行，第%d列的数字：", i+1, j+1)
			fmt.Scanln(&num)
			twoDimensionArr[i][j] = num
		}
		fmt.Println(twoDimensionArr[i])
	}
	// 四周数据清0
	for i := 0; i < len(twoDimensionArr); i++ {
		if i == 0 || i == 2 {
			for j := 0; j < len(twoDimensionArr[i]); j++ {
				twoDimensionArr[i][j] = 0
			}
		}
		if i == 1 {
			for j := 0; j < len(twoDimensionArr[i]); j++ {
				if j == 0 || j == len(twoDimensionArr[i])-1 {
					twoDimensionArr[i][j] = 0
				}
			}
		}
		fmt.Println(twoDimensionArr[i])
	}
}
